import 'package:json_annotation/json_annotation.dart';

enum HBRtmMessageType {
  rtmSmallMessageTypeText(0, '文字消息'),
  rtmSmallMessageTypeReward(1, '打赏礼物'),
  rtmSmallMessageTypeUserJoin(2, '用户进入'),
  rtmSmallMessageTypeUserUpper(3, '用户上麦'),
  rtmSmallMessageTypeUserDown(4, '用户下麦'),
  rtmSmallMessageTypeUserCanSpeech(5, '解除禁言'),
  rtmSmallMessageTypeUserCannotSpeech(6, '用户禁言'),
  rtmSmallMessageTypeOpenChat(7, '开启公屏'),
  rtmSmallMessageTypeCloseChat(8, '关闭公屏'),
  rtmSmallMessageTypeAssignOrder(9, '发单'),
  rtmSmallMessageTypeAddTime(10, '加时长'),
  rtmSmallMessageTypeVestOperation(11, '马甲操作'),
  rtmSmallMessageTypeRefreshSeat(12, '刷新麦位'),
  rtmSmallMessageTypeApplySeat(13, '申请上麦'),
  rtmSmallMessageTypeRoomForbidden(14, '聊天室封禁'),
  rtmSmallMessageTypeUserCloskSpeak(15, '用户关闭语音说话'),
  rtmSmallMessageTypeSendEmoji(16, '用户发送表情'),
  rtmSmallMessageTypeCloseRoom(17, '用户关闭房间'),
  rtmSmallMessageTypeRoomInfoChanged(18, '房间信息变更'),
  rtmSmallMessageTypeOpenGoldBox(19, '开jin箱子'),
  rtmSmallMessageTypeNobleRateChanged(21, '贵族等级变化'),
  rtmSmallMessageTypeHotFireTime(22, '火力全开倒计时'),
  rtmSmallMessageTypeFriendNextStep(23, '交友厅当前环节'),
  rtmSmallMessageTypeFriendSelect(24, '用户心动结果选择'),
  rtmSmallMessageTypeFriendResult(25, '用户心动结果公布'),
  rtmSmallMessageTypeFriendSuccess(26, '用户牵手成功'),
  rtmSmallMessageTypeOpenGuard(27, '用户开通或者续费守护'),
  rtmSmallMessageTypeGuideBuyGuard(28, '引导用户开通守护类型消息'),
  rtmSmallMessageTypeSystemWarning(29, '用户进入聊天室后公屏系统新增房间违规警告消息'),
  rtmSmallMessageTypePoliceForbiddenUser(30, '用户被巡管封禁进入房间'),
  rtmSmallMessageTypePoliceNoSpeech(31, '用户被巡管禁言'),
  rtmSmallMessageTypePoliceWarningUser(32, '用户被巡管警告'),
  rtmSmallMessageTypeSystemForbiddenRoom(33, '房间被巡管或控制台封禁'),
  rtmSmallMessageTypePoliceClearChat(34, '房间被巡管清屏'),
  rtmSmallMessageTypePoliceWarningRoom(35, '房间被巡管警告'),
  rtmSmallMessageTypeReceiveFreeGift(36, '房间内获得免费礼物（本地消息）'),
  rtmSmallMessageTypeWelcomeOrderRoom(37, '派单厅欢迎语（本地消息）'),
  rtmSmallMessageTypeHostWelcome(38, '主播看到的用户入场消息'),
  rtmSmallMessageTypeOtherWelcome(39, '间内除自己和主播外的其他用户看到的用户入场消息'),
  rtmSmallMessageTypeHostInvite(40, '主播邀请上麦，仅匹配当前登录用户'),
  rtmSmallMessageSendGiftBox(41, '聊天室内送礼盒成功'),
  rtmSmallMessageRobRedPacket(43, '用户抢红包'),
  rtmSmallMessageRedPacketBestUser(44, '红包被抢后发送的最佳手气消息'),
  rtmSmallMessageSendRedPacket(45, '用户送出红包'),
  rtmSmallMessageTypeToggleCharmCount(46, '开关魅力值(内部:0 表示关闭 1表示开启 2表示清零'),
  rtmSmallMessageCountDownTime(47, '房间内倒计时消息'),
  rtmSmallMessageRobHat(48, '房间内抢帽子的声网消息'),
  rtmSmallMessageChangeBackImg(49, '房间内更换背景壁纸'),
  rtmSmallMessageTypeLiveRoomLianmai(50, '聊天室房间连麦开启/关闭的声网消息'),
  rtmSmallMessageTypeLiveRoomFollow(51, '聊天室内直播关注主播的声网消息'),
  rtmSmallMessageGiftFlyAnimation(52, '礼物飞入动画'),
  rtmSmallMessageTypeRoomVipUpgrade(53, '升级黄金/黑金及激活贵宾的消息'),
  rtmSmallMessageTypeGiftAnimationSwitch(54, '礼物动效开关提示消息（本地）'),
  rtmSmallMessageJoinFansClub(55, '用户加入粉丝团成功'),
  rtmSmallMessageFansLevelUp(56, '粉丝团粉丝等级提升'),
  rtmSmallMessageTypeNewUserWelfare(57, '新人福利提示消息（本地）'),
  rtmSmallMessageTypeLiveWishList(58, '主播心愿礼物'),
  rtmSmallMessageJoinFansClubNew(59, '粉丝2.0加入'),
  rtmSmallMessageBoxFragmentsPlay(60, '宝箱碎片玩法'),
  rtmSmallMessageTypeRoomInPK(61, '房间内团战PK'),
  rtmSmallMessageTypeRoomOutPK(62, '房间和房间PK'),
  rtmSmallMessageTypeRoomAudioLivePK(63, '语音直播PK'),
  rtmSmallMessageTypeLivePkGuestMute(64, '直播PK,嘉宾位闭麦消息(点对点)'),
  rtmSmallMessageTypePkGuestAllMute(65, '直播PK,嘉宾位闭麦消息(全房间)'),
  rtmSmallMessageTypePkResultFormServer(66, '服务端发送的pk消息（接受、结束、结果）'),
  rtmSmallMessageTypeRefreshMatch(67, '夏日联赛刷新消息'),
  rtmSmallMessageTypeRoomPauseOrStart(68, '发送的直播暂停/继续消息'),
  rtmSmallMessageTypeRefreshRocket(69, '火箭刷新消息'),
  rtmSmallMessageTypeRoomCP(70, '服务器发送婚礼消息'),
  rtmSmallMessageTypeUserSong(71, '用户点歌'),
  rtmSmallMessageTypeUpadteSongs(72, '主持操作歌曲待唱列表'),
  rtmSmallMessageTypeC2CModifySeatCount(73, 'C2C操作麦位数量的声网消息'),
  rtmSmallMessageTypeSendGameCard(74, '发送游戏名片声网消息'),
  rtmSmallMessageTypeSeatMicModule(75, 'C2C房间上麦模式修改'),
  rtmSmallMessageTypeKickoutUser(76, '把用户踢出房间'),
  rtmSmallMessageTypeSearchingPeople(77, 'C2C开始寻人'),
  rtmSmallMessageTypeRoomCategoryChanged(78, 'C2C房间类型切换'),
  rtmSmallMessageTypeKTV(
      79, 'ktv玩法相关（1：开启，2：点歌，3：切歌，4：置顶，5：删除，6：关闭 7.下载前 8.下载成功）'),
  rtmSmallMessageTypeKTVFromService(80, '服务端发送演唱者下麦消息'),
  rtmSmallMessageTypedrawGuessPointData(81, '你画我猜线条数据'),
  rtmSmallMessageTypedrawGuess(82, '你画我猜玩法状态'),
  rtmSmallMessageTypedrawGuessService(83, '服务器发送你画我猜玩法状态'),
  rtmSmallMessageTypedrawGuessServiceClose(84, '服务器发送关闭你画我猜'),
  rtmSmallMessageTypedrawGuessSendEgg(85, '你画我猜送鸡蛋鲜花'),
  rtmSmallMessageTypeFrienfChainChange(86, '开启和关闭牵手模板'),
  rtmSmallMessageTypeDint(87, '谁是卧底状态改变'),
  rtmSmallMessageTypeDintService(88, '服务器发送谁是卧底状态改变'),
  rtmSmallMessageTypeDintServiceClose(89, '服务器发送关闭谁是卧底'),
  rtmSmallMessageTypeMaskFaceGame(
      90, '蒙面玩法声网消息 (1：开启模板，2：开始游戏 3 结束游戏 4 关闭模板 5 蒙面加时)'),
  rtmSmallMessageTypeRoomActivity(91, '房间内活动'),
  rtmSmallMessageTypeUpdateSeatQueue(92, '更新上麦队列的声网消息'),
  rtmSmallMessageTypeInteractivePlay(93, '聊天室主持人互动玩法发起'),
  rtmSmallMessageTypeInteractStatusChange(94, '聊天室主持人互动玩法入口更新'),
  rtmSmallMessageTypeMouthPieceMsg(95, '传声筒声网消息'),
  rtmSmallMessageTypeDynamicConfigPlayMsg(
      96, '萝卜蹲,正话反说,我有你没有等声网消息(后续相同类型的玩法会继续沿用此消息'),
  rtmSmallMessageTypeCategoryChangedNew(97, '其他房间谁是卧底、你画我猜切换（同78、兼容安卓旧版本崩溃问题）'),
  rtmSmallMessageTypeTruthOrDare(98, '真心话大冒险消息'),
  rtmSmallMessageTypeNewHandService(99, '服务器发送新牵手异常消息'),
  rtmSmallMessageTypeBuildRelation(100, '房间内亲密关系(1.邀请建立;2.接受邀请)'),
  rtmSmallMessageTypeToutiao(101, '房间内派对头条'),
  rtmSmallMessageTypeSendTicket(102, '派单厅和大神带飞厅赠送开黑券礼物'),
  rtmSmallMessageTypeInviteOrder(103, '派单厅和大神带飞厅邀请用户下单'),
  rtmSmallMessageTypeWerewolfKill(104, '狼人杀'),
  rtmSmallMessageTypeYearEndMsg(105, '年度盛典锦鲤'),
  rtmSmallMessageTypeGiftWallSendMsg(106, '礼物墙点墙通知'),
  rtmSmallMessageTypeRefreshSeatCompress(107, '刷新麦位消息,内部做了压缩（对12号消息做优化）'),
  rtmSmallMessageTypeSendGiftBoxFloatScreen(108, '礼盒飘屏'),
  rtmSmallMessageTypeBlackTeam(109,
      '大神带飞厅开黑组队（1：更新队伍列表信息，2：分享队伍信息，3：yahabibi-西瓜 已对 2号队伍 支付 开黑券 x5，4：cc国服第一小乔 选择 2号队伍 进行带队，5：大神发起开黑房间邀请（用户收到消息需要展示进开黑房二次确认弹框），6：开启玩法 7.关闭玩法）'),
  rtmSmallMessageTypeBlackTeamFromService(110, '大神带飞厅开黑组队服务器发消息'),
  rtmSmallMessageTypeChorus(111, '一起k歌玩法'),
  rtmSmallMessageTypeScore(112, '一起k歌总评分'),
  rtmSmallMessageTypeGrab(113, '欢乐抢唱玩法'),
  rtmSmallMessageTypeGetCarGiftServer(120, '房间获得座驾消息'),
  rtmSmallMessageTypeCarProgressServer(121, '服务器发送的WS消息，更新座驾进度'),
  rtmSmallMessageTypeSignStatusChanged(122, '签到信息变更'),
  rtmSmallMessageTypeGangUpDemand(123, '发送开黑需求'),
  rtmSmallMessageTypeBirthdayParty(124, '生日会消息类型'),
  rtmSmallMessageTypeSystemWarningForSingleUser(125, ''),
  rtmSmallMessageTypeRoomLock(126, '新增一个房间上锁消息类型'),
  rtmSmallMessageTypeH5InteracPlay(127, '房间互动游戏'),
  rtmSmallMessageTypeBarrageBuffGift(128, '房间互动游戏 buff 礼物'),
  rtmSmallMessageTypeBarrageInvitation(129, '房间互动游戏 跨房 邀请通知');

  final int value;
  final String name;

  const HBRtmMessageType(this.value, this.name);

  // 值到枚举的映射表
  static final Map<int, HBRtmMessageType> _byValue = {
    for (final e in HBRtmMessageType.values) e.value: e,
  };

  // 通过整数值获取枚举
  static HBRtmMessageType? fromValue(int value) => _byValue[value];
}

// 自定义 JsonConverter
class HBRtmMessageTypeConverter extends JsonConverter<HBRtmMessageType?, int?> {
  const HBRtmMessageTypeConverter();

  @override
  HBRtmMessageType? fromJson(int? json) {
    if (json == null) {
      return null;
    }
    return HBRtmMessageType.fromValue(json);
  }

  @override
  int? toJson(HBRtmMessageType? object) {
    return object?.value;
  }
}
